<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>还款情况（财务）</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<script type="text/javascript">

var update = '${update}';
var grid = null;
$(function () {
	initGrid();//grid
	  $("#searchBar").ligerForm();
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
});
  function clearBtn(){
	    $("#searchBar").ligerForm();
				var form = new liger.get("searchBar");
				form.setData({
					cstNm:"",
					splNm:"",
					prjNm:"",
					prjTypCd:"",
					buOrgCd:"",
					bizTypCd:"",
					lsDt:"",
					lsCntNo:"",
					timeType:"",
					strDate:"",
					endDate:"",
					prdStsCd:"",
					paySchNo:""
				 });
		}
//初始化列表
function initGrid(){
	var params = {};
	var urlPath = 
	$("#grid").ligerGrid({
    	url: '<%=path%>/project/prjprdpayschm/getPrjPrdPaySchMList.do',
    	method : 'get',
    	parms:params,
        columns: [
                  { display: '合同编号', name: 'lsCntNo', minWidth: 150 ,align:'left',enabledSort:true},
            { display: '支付表号', name: 'paySchNo', minWidth: 200,align:'left',
                	 	render: function (rowdata, rowindex, value, column) { 
    	            		var h = '';
    	            		    h='<a href="javascript:detailBtn(';
    	                        h+="'"+rowdata.prjPrdDtlId+"',";
    	                        h+="'"+rowdata.id+"',";
    	                        h+="'"+rowdata.prjPrdId+"',";
    	                        h+="'"+rowdata.prjId+"'";
    	                        h+=')">'+value+'</a>'
    	                        return h;
    	            		},
                	  enabledSort:true},
            { display: '承租人名称', name: 'cstNm', minWidth: 80,align:'left',enabledSort:true}, 
            { display: '状态', name: 'prdStsCdNm', minWidth: 80,align:'left',enabledSort:true}, 	
            { display: '创建时间', name: 'crtTm', minWidth: 80,align:'left',render:renderDate,enabledSort:true}, 
             { display: '起租日', name: 'lsDt', minWidth: 80,align:'left',render:renderDate,enabledSort:true}, 	
             { display: '结清时间', name: 'stlDt', minWidth: 80,align:'left',render:renderDate,enabledSort:true}, 	
             { display: '拖回时间', name: 'backDt', minWidth: 80,align:'left',render:renderDate,enabledSort:true}, 	
             { display: '转正常时间', name: 'formDt', minWidth: 80,align:'left',render:renderDate,enabledSort:true}, 	
             { display: '申请单号', name: 'pNo', minWidth: 140 , 
	              	render: function (rowdata, rowindex, value, column) { 
	            		var h = '';
	            		var prdStsCd = rowdata.prdStsCd;
         			if(value&&value!="null"){
         				if(prdStsCd.indexOf(ProjectConstant.CODE_PRJ_PAY_SET)==0||prdStsCd.indexOf(ProjectConstant.CODE_PRJ_PAY_PRE_SET)==0){
		            		h+='<a href="javascript:commShowFlow(';
	            		    h+="'"+rowdata.pinstId+"',";
	            		    h+="'"+rowdata.audStsCd+"',";
	            		    h+="'"+rowdata.id+"',";
	            		    h+="'"+rowdata.prdStsCd+"'";
	            		    h+=')">'+value+'</a>'
         				}
         			}
                     return h;
         		},
	            	enabledSort:true}, 
             {
                display: '操作',
                isSort: false,
                width: 200,
                align:'center',
                isEllipsis: false,
                render: function (rowdata, rowindex, value){
                    var h="";
                    h+='<a class="sq-button-hasicon" href="javascript:payDetail(';
                    h+="'"+rowdata.id+"'";
                    h+=')"><i class="sqBtnIco_2"></i>查看还款情况</a>';
                    return h;
                }
            }  
        ],
        pageSize:10,
        root:'rows',
        record:'total',
        hideLoadButton : true,
        width: '100%',
        height:'100%',
        heightDiff:-2,
        checkbox:true,
        allowUnSelectRow: true,
        alternatingRow: true,
        rownumbers:true,
        enabledEdit: false,
        fixedCellHeight: false,
        usePagerOnLessPagesize: true,
    });
	grid = liger.get("grid");
	grid.setHeight(300);
	
}
//显示流程
function commShowFlow(_pInstId, _audStsCd, _businessKey,prdStsCd,buOrgCd){
	if(StringUtils.isEmpty(_pInstId)){
		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
		return;
	}
	
	var _formUrl = "";
    if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_CAR){
    	if(prdStsCd.indexOf(ProjectConstant.CODE_PRJ_PAY_PRE_SET)==0){
			 _formUrl = "/project/prjprdpayschm/addCarPreSettleFeePage.do?isDetail=1"+"@@processInstanceId="+_pInstId+"@@paySchId=";
		}
    }else{
		if(prdStsCd.indexOf(ProjectConstant.CODE_PRJ_PAY_SET)==0){
			 _formUrl = "/project/prjprdpayschm/settleAddFeePage.do?isDetail=1"+"@@processInstanceId="+_pInstId+"@@paySchId=";
		}
		if(prdStsCd.indexOf(ProjectConstant.CODE_PRJ_PAY_PRE_SET)==0){
			 _formUrl = "/project/prjprdpayschm/addPreSettleFeePage.do?isDetail=1"+"@@processInstanceId="+_pInstId+"@@paySchId=";
		}
    }
	
	//var _formUrl = "/project/audit/toAdditionalInfoPage.do?isDetail=1"+"@@processInstanceId="+_pInstId+"@@projectId=";
	var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
	Add_navTab('tab_cst_invoice_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
	
}
//格式化为人民币格式
function renderAmt(rowdata, rowindex, value) {
    var h="￥" + FormatMoney(value)
    return h;
}

//格式化时间
function renderDate(rowdata, index, value){
	var dateStr = "";
	if(null != value&&value!=''){
		var date = new Date(value);
		dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
	}
	return dateStr;
}

function payDetail(id){
	var payDetailUrl = '<%=path%>/capital/capFund/toRepaymentSituationDetailPage.do?id='+id;
	Add_navTab('tab_prj_quat_prps_pay'+id,'查看还款情况',payDetailUrl);
}

var onSave = function (item, Dialog) {
 //在子页面里绑定 frameElement.dialog.onOk = function () {}
	if (Dialog.onSave) Dialog.onSave();
};

var onCancel = function (item, Dialog) {
	 //在子页面里绑定 frameElement.dialog.onOk = function () {}
		if (Dialog.onCancel) Dialog.onCancel();
};

function iframeResize () {
    if (parent.mainApp) {
        parent.mainApp.parentTab.onResize();
    };
}

function detailBtn(prjPrdDtlId,id,prjPrdId,prjId){
	var editFlag = true;
	Add_navTab('tab_prj_quat_prps'+id,'查看支付表','<%=path%>/project/prjprdpayschm/toAddPage.do?prjId='+prjId+'&&id='+id+'&&prjPrdDtlId='+prjPrdDtlId+'&&prjPrdId='+prjPrdId+'&&detailFlag='+editFlag);
 }

</script>

<body class="iframeBody">
	<div class="Wrapper">
        <div>
           <div id="pageInTab" class="pageInTab">
 <div class="searchArea">
    <form id="searchBar">
   <div class="fieldset1 clearFix">
   		  <div class="fieldBox col_33" >
                <div class="label">客户名称</div>
                <div class="field">
                    <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
              <div class="fieldBox col_33" >
                <div class="label">项目名称</div>
                <div class="field">
                    <input name="prjNm" id="prjNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="fieldBox">
              <div class="label">项目类型</div>
                <div class="field">
                <select name="prjTypCd"  id="prjTypCd" >
                 <option value="  " selected="selected">--请选择--</option>
                 <c:forEach items="${projectTypeList}" var="opt">
                  <option value="${opt.key}">${opt.value}</option>
                 </c:forEach>
                </select>
                </div>
            </div>
              <div class="fieldBox">
            <div class="label">业务类型</div>
               <div class="field">
                 <select name="bizTypCd"  id="bizTypCd"  >
                  <option value="  " selected="selected">--请选择--</option>
                <c:forEach items="${bizTypeList}" var="opt">
                 <option value="${opt.key}">${opt.value}</option>
                </c:forEach>
               </select>
               </div>
            </div>
               <div class="fieldBox">
                <div class="label">所属事业部</div>
                <div class="field">
                    <select name="buOrgCd" id="buOrgCd">
                        <option value=" " seleted>请选择</option>
                        <c:forEach items="${orgListList }" var="org">
                        	<c:if test="${currentBuOrgCd == org.key }">
                        		<option value="${org.key }" selected>${org.value }</option>
                        	</c:if>
                        	<c:if test="${currentBuOrgCd != org.key }">
                        		<option value="${org.key }">${org.value }</option>
                        	</c:if>
                        </c:forEach>
                    </select>
                </div>
            </div>
              <div class="fieldBox col_33" >
                <div class="label">供应商名称</div>
                <div class="field">
                    <input name="splNm" id="splNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
            
             <div class="fieldBox col_33" id="searchCstNmId">
                <div class="label">起租日</div>
                <div class="field">
                    <input name="lsDt" id="lsDt" type="text" class="ui-datepicker" value="">
                </div>
            </div>
            <div class="fieldBox col_33" >
                <div class="label">合同编号</div>
                <div class="field">
                    <input name="lsCntNo" id="lsCntNo" type="text" class="ui-textbox" value="">
                </div>
            </div>
           <div class="fieldBox col_33" >
                <div class="label">是否删除</div>
                <div class="field">
                    <select name="isDel"  id="isDel"  >
		                  <option value="0"  selected="selected">否</option>
		                 <option value="1">是</option>
	               </select>
                </div>
            </div>
             <div class="fieldBox col_33">
                <div class="label">支付表状态</div>
                <div class="field">
	               <select name="prdStsCd"  id="prdStsCd"  >
	                  <option value="  " selected="selected">--请选择--</option>
	                <c:forEach items="${prdStsCdList}" var="opt">
	                 <option value="${opt.key}">${opt.value}</option>
	                </c:forEach>
	               </select>
                </div>
            </div>
              <div class="fieldBox col_33" >
                <div class="label">支付表号</div>
                <div class="field">
                    <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="">
                </div>
            </div>
             <div class="fieldBox col_33" id="searchCstNmId">
                <div class="label">时间</div>
                <div class="field">
                 <select name="timeType"  id="timeType"  >
	                  <option value="  " selected="selected">--请选择--</option>
	                 <option value="stl">结清时间</option>
	                  <option value="back">拖回时间</option>
	                   <option value="form">转正常时间</option>
	               </select>
	               
                     <input name="strDate" id="strDate" type="text" class="ui-datepicker" value="">
                     <span>---</span>
                      <input name="endDate" id="endDate" type="text" class="ui-datepicker" value="">
                </div>
            </div>
            <div class="clearFix"></div>
   	<div class="btnsBox">
   			<span id="searchBtn"  class="sq-button sq-button-round">查询</span>
           <span id="clearBtn" onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
 	</div>
</div>
</form>
</div>
<div id="grid" class="sq-grid"></div>
</div>
	</div>
		</div>
<div id="changeLsDt" style="display:none">
    <form id="changeLsDt_form">
        <div class="fieldset1 tabel_col tabel_col_s noBorder clearFix">
            <div class="fieldBox col_50">
                <div class="label">起租日</div>
                <div class="field">
                    <input name="lsDtParam" id="lsDtParam" type="text" class="ui-datepicker" validate="{required:true}" value="">
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
        </div>
        <div class="btnsBox">
            <span class="sq-button sq-button-hasicon Hide"><i class="sqBtnIco_10"></i>保存</span>
            <span class="sq-button sq-button-hasicon l-dialog-btn-cancel Hide"><i class="sqBtnIco_14"></i>取消</span>
        </div>
    </form>
</div>		
</body>
</html>